function event_action_remote() {
    click($('.delete-slot-ajax'), function($element) {
        var presta_id = $element.attr('data-presta-id');
        if(presta_id != undefined) {
            ajaxForce(WEBROOT+'/FastService/GetEventData.php', {
                'event_id':presta_id
            }, function(data) {
                if(data.length) {
                    calEvent = json_decode(data);
                    delete_event(calEvent, function() {
                        $('#client-rdv-item-'+presta_id).remove();
                        closePopup($('div[data-object="msa_clientobject"]').find('.erra-field:first'));
                    });
                }
            });
        }
    });
    click($('.edit-slot-ajax'), function($element) {
        var presta_id = $element.attr('data-presta-id');
        if(presta_id != undefined) {
            ajaxForce(WEBROOT+'/FastService/GetEventData.php', {
                'event_id':presta_id
            }, function(data) {
                if(data.length) {
                    calEvent = json_decode(data);
                    slot_object_init_static(calEvent);
                }
            });
        }
    });
    
}


/* DELETE BUTTON */
function callback_delete_event_cross(eventId, eventOccurency, bAddEventOccurency, strSrc) {
    var post_array = {};
    post_array['object_id'] = eventId;
    if(strSrc != undefined) {
        post_array['source'] = strSrc;
    }
    if(bAddEventOccurency == true || bAddEventOccurency=="n") {
        if(bAddEventOccurency == "n") {
            eventOccurency += '_n';
        }
        post_array['current_occurency'] = eventOccurency;
    }
    ajaxForce(WEBROOT+"/delete_event", post_array, function(data) {
        $('.ajax-config-validator').show().delay(1500).fadeOut(500);
    });
    
}

                          
function delete_event(calEvent, validateExec) {
    if(calEvent.event_type == 'presta') {
        alert_jqueryui_($('#delete-slot-window'), "Supprimer à la demande du client",  "Supprimer pour des raisons internes (prévient le client par mail et/ou SMS)", "Annuler", function() {
            calEvent.source = "client";
            addToLocalStore('DELETE_EVENT', calEvent);
            if(validateExec != undefined) {
                validateExec();
            }
            executeLocalStack();
        },
        function() {
            calEvent.source = "internal";
            addToLocalStore('DELETE_EVENT', calEvent);
            if(validateExec != undefined) {
                validateExec();
            }
            executeLocalStack();
        });
    } else {
        alert_jqueryui__($('#delete-slot-window'), "Supprimer uniquement cet évènement", "Supprimer cet évènement et les suivants", "Supprimer toute la plage d'évènement", "Annuler", function() {
            calEvent.slots_to_delete = 'only_this';
            addToLocalStore('DELETE_EVENT', calEvent);
        },function() {
            calEvent.slots_to_delete = 'this_and_further';
            addToLocalStore('DELETE_EVENT', calEvent);
        },function() {
            calEvent.slots_to_delete = 'all';
            addToLocalStore('DELETE_EVENT', calEvent);
        });
        
    }
}